<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>恒悦电商</title>

    <!-- Bootstrap Core CSS -->
    <link href="/App/Admin/public/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="/App/Admin/public/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="/App/Admin/public/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="/App/Admin/public/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

    <div class="container">
        <div class="row">
            <div class="col-md-4 col-md-offset-4">
                <div class="login-panel panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">请登录</h3>
                    </div>
                    <div class="panel-body">
                        <form method="post">
                            <fieldset>
                                <div class="form-group">
                                    <input class="form-control" placeholder="用户名"  id="admin_username"  name="email" type="text" autofocus>
                                </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="密码" id="admin_password"  name="password" type="password" value="">
                                </div>
                               
								
							     <div class="form-group">
								
							
								 <input type="text" class="form-control"   id="admin_valid"   maxlength="2" placeholder="验证码" />
					  
								 <img src='{:U("Login/sendAdminValid")}' id='valid' onclick='javascript:changeValid()'  align="absmiddle" />
					  
								</div>
								
							
								
								<input class="btn btn-lg btn-success btn-block"  id="login-lq"value="登录">
                            </fieldset>
							<div style="text-align: center;font-size:16px;color:#F00" id="infotest">    </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- jQuery -->
    <script src="/App/Admin/public/vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="/App/Admin/public/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="/App/Admin/public/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
  <!--  <script src="/App/Admin/public/dist/js/sb-admin-2.js"></script>-->
	
	<script>  
		    function changeValid(){
	     	$("#valid").attr('src','{:U("Login/sendAdminValid?r=")}?r='+Math.random());
	        }
    </script>
	
	<script type="text/javascript"> 
	$('#login-lq').on('click',function(){
        var username = $('#admin_username').val();
	var password = $('#admin_password').val();
	var valid = $('#admin_valid').val();
	
   
    if( username == '' || password == ''  || valid == '' ){
	   
	/*   alert(2222);die();*/
	
	    $('#infotest').html("请完善您的登录信息");  
		return false;
		
		
	    }
    
	$.post('{:U('Login/userLogin')}',{username:username,password:password,valid:valid},function(data){
		
		
		
		if(data.status==100){
		
	    	/*alert(data.info);die;*/
		     $('#infotest').html(data.info);  
		     window.location='{:U('Index/index')}';
			}else{
			
	         /* $('#infotest').html(data.info);  
			      setTimeout(2000);*/
				  alert(data.info);
				     $('#infotest').html("");  
		    }
		})
	
	   

	
});
	</script>

</body>

</html>
